Don't g_object_unref cairo surfaces
authorMatthias Clasen <mclasen@redhat.com>
Thu, 3 Feb 2011 03:05:26 +0000 (22:05 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 3 Feb 2011 03:05:26 +0000 (22:05 -0500)
This was causing warnings when dragging text from labels.

gtk/gtklabel.c

index 12b0d6a33c86fdca1c16a2600e1c776a21e4138d..a99f7a1b639e17ca5d300c4687b168bb34d3426e 100644 (file)
@@ -4883,22 +4883,24 @@ drag_begin_cb (GtkWidget      *widget,
 
       if (end > len)
         end = len;
-      
+
       if (start > len)
         start = len;
-      
-      surface = _gtk_text_util_create_drag_icon (widget, 
-                                                priv->text + start,
-                                                end - start);
+
+      surface = _gtk_text_util_create_drag_icon (widget,
+                                                 priv->text + start,
+                                                 end - start);
     }
 
   if (surface)
-    gtk_drag_set_icon_surface (context, surface);
+    {
+      gtk_drag_set_icon_surface (context, surface);
+      cairo_surface_destroy (surface);
+    }
   else
-    gtk_drag_set_icon_default (context);
-  
-  if (surface)
-    g_object_unref (surface);
+    {
+      gtk_drag_set_icon_default (context);
+    }
 }
 
 static gboolean